package com.teach.basic.controller;

import com.common.bean.Response;
import com.teach.basic.model.dto.AssociatorDTO;
import com.teach.basic.model.po.Associator;
import com.teach.basic.service.impl.AssociatorServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 会员表 前端控制器
 * </p>
 * @version 1.0
 * @author hzz
 * @since 2020-02-18
 */
@Validated
@RestController
@RequestMapping("/user")
public class LoginController {
    @Autowired
    private AssociatorServiceImpl serviceAssociator;

    @RequestMapping("/register")
    public Response<Object> register(@RequestBody @Validated AssociatorDTO entity){
        return Response.ok(serviceAssociator.register(entity));
    }

    @RequestMapping("/login")
    public Response<Object> login(@RequestParam("openId") String openid){
        return Response.ok(serviceAssociator.login(openid));
    }

}

